
var win = null;

Event.observe(window, 'load', function() {
	
	MainForm = $('frmBuscar');
	
}); 


function doBuscar (){

	var searchBy = $('searchBy').value;
	
	if( $('searchValue')==null ){
		alert("No ha seleccionado valor de busqueda");
		return;
	}
		
	var searchValue = $('searchValue').value;
	
	new Ajax.Updater($('containerOutput'), 'cartelera.htm', {
		parameters: {'method':'buscar', 
		'searchBy':searchBy, 
		'searchValue': searchValue},
		onCreate: function(){
			
		},
		onException: function(t,e){
			alert(e.message);
		}
	});
	
}


function selectedRow(cell){
	
	var id = cell.parentNode.parentNode.getAttribute("peliculaId");

	IMessage.show('peliculaDetailBox', '680px', '550px', true);
	
	new Ajax.Updater($('peliculaDetailBox_content'), 'cartelera.htm', {
		parameters: {'method':'pelicula', 'peliculaId':id},
		onCreate: function(){
			
		},
		onException: function(t,e){
			alert(e.message);
		}
	});
	
}


function onSearchBySelection(){
	var searchBy = $('searchBy').value;

	new Ajax.Updater($('comboOutput'), 'cartelera.htm', {
		parameters: {'method':'selectType', 'searchBy':searchBy},
		onCreate: function(){
			$('comboOutput').innerHTML = "Espere un momento...";
		},
		onException: function(t,e){
			alert(e.message);
		}
	});
	
}